package com.foreknow.demo11;

import com.foreknow.trains.train8.SouthEastTiger;

import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

public class ArrayListDemo {
    public void m1(List<Student> list){
        for (Student s:list){
            System.out.println(s.getName()+"  "+s.getAge());
        }
    }

    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        System.out.println("请输入用户名：");
        String name = input.next();
        System.out.println("请输入年龄：");
        int age = input.nextInt();

        Student student = new Student();
        student.setName(name);
        student.setAge(age);

        List<Student> list = new ArrayList<>();
        list.add(student);

        ArrayListDemo arrayListDemo = new ArrayListDemo();
        arrayListDemo.m1(list);
    }
}
